package com.kila.service.impl;

import com.kila.dao.StudentDao;
import com.kila.dao.impl.StudentDaoImpl;
import com.kila.entity.Student;
import com.kila.service.StudentService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.sql.SQLException;

public class StudentServiceImpl implements StudentService {


    StudentDao studentDao = new StudentDaoImpl();



    public void setStudentDao(StudentDao studentDao) {
        this.studentDao = studentDao;
    }


    @Transactional(readOnly = false,propagation = Propagation.REQUIRED,rollbackFor= {SQLException.class})
    @Override
    public void addStudent(Student student) {
         //if(该学生是否存在)
        //增加其他
        studentDao.add(student);

    }
}
